package com.hspedu.homework;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/1/29
 * @time 18:58
 */
public class Homework05 {
    public static void main(String[] args) {
        A a = new A("A");
        A.B b = a.new B("B");
        b.show();

        a.test();
    }
}

class A{

    private final String name;

    A(String name) {
        this.name = name;
    }

    public void test(){
        class B{
            private String name = "hsp";
            public void show(){
                System.out.println(A.this.name);
                System.out.println(name);
            }
        }
        B b = new B();
        b.show();
    }

    class B{
        private final String name;

        B(String name) {
            this.name = name;
        }

        public void show(){
            System.out.println(A.this.name);
            System.out.println(name);
        }
    }
}
